/**
 * 
 */
package GUI.main;

import java.awt.BorderLayout;
import java.awt.Dimension;

import javax.swing.JFrame;
import javax.swing.JPanel;

import GUI.calendar.CalendarPanel;
import GUI.main.navigation.NavigationMenuPanel;
import GUI.network.OfficeConnection;
import officeserver.users.User;

/**
 * @author mramsey3
 * 
 */
public class MainFrame extends JFrame {

	/**
     * 
     */
	private static final long serialVersionUID = 1L;
	public static final int WIDTH = 600;
	private static final int HEIGHT = 600;

	private JPanel mainPanel;
	private TopPanel topPanel;
	private JPanel navAndCalendar;
	private NavigationMenuPanel navigationMenuPanel;
	private CalendarPanel calendarPanel;

	/**
	 * @param user
	 */
	public MainFrame() {
		super();
		setTitle(MainClient.FRAME_TITLE);
		setPreferredSize(new Dimension(WIDTH, HEIGHT));
		setContentPane(getMainPanel());
	}

	/**
	 * @author mramsey3
	 * @return
	 */
	public JPanel getMainPanel() {
		if (mainPanel == null) {
			mainPanel = new JPanel();
			mainPanel.setLayout(new BorderLayout());
			mainPanel.add(getTopPanel(), BorderLayout.NORTH);
			mainPanel.add(getNavAndCalendar(), BorderLayout.CENTER);
		}
		return mainPanel;
	}

	/**
	 * @author mramsey3
	 * @return
	 */
	public TopPanel getTopPanel() {
		if (topPanel == null) {
			topPanel = new TopPanel();
		}
		return topPanel;
	}

	/**
	 * @author mramsey3
	 * @return
	 */
	public JPanel getNavAndCalendar() {
		if (navAndCalendar == null) {
			navAndCalendar = new JPanel();
			navAndCalendar.setLayout(new BorderLayout());
			navAndCalendar.setPreferredSize(new Dimension(450, 450));
			navAndCalendar.add(getNavigationMenuPanel(), BorderLayout.WEST);
			navAndCalendar.add(getCalendarPanel(),BorderLayout.CENTER);
		}
		return navAndCalendar;
	}

	/**
	 * @author mramsey3
	 * @return
	 */
	public NavigationMenuPanel getNavigationMenuPanel() {
		if (navigationMenuPanel == null) {
			navigationMenuPanel = new NavigationMenuPanel();
		}
		return navigationMenuPanel;
	}
	
	private JPanel getCalendarPanel(){
	    if(calendarPanel == null){
		calendarPanel = new CalendarPanel();
	    }
	    return calendarPanel;
	}

}
